package com.ruoyi.customerService.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.customerService.domain.CsClaimType;
import com.ruoyi.customerService.service.CsClaimTypeService;
import com.ruoyi.hqfinance.domain.HqCostKind;
import com.ruoyi.hqfinance.service.HqCostKindService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/hq/claimType")
@Api(tags = "客服中心-理赔账单-理赔类型")
public class CsClaimTypeController {
    @Autowired
    private CsClaimTypeService csClaimTypeService;


    @ApiOperation("查大类")
    @GetMapping("/oneLevel")
    public R selectOneLevel() {
        List<CsClaimType> csClaimTypes = csClaimTypeService.selectByOneLevel();
        if (csClaimTypes == null || csClaimTypes.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(csClaimTypes);
        }
    }
    @ApiOperation("查小类")
    @GetMapping("/twoLevel")
    public R selectTwoLevel() {
        List<CsClaimType> csClaimTypes = csClaimTypeService.selectByTwoLevel();
        if (csClaimTypes == null || csClaimTypes.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(csClaimTypes);
        }
    }



    @ApiOperation("根据大类查小类")
    @GetMapping("/selectByParentId")
    public R selectByParentId(Integer parentId) {
        List<CsClaimType> csClaimTypes = csClaimTypeService.selectByParentId(parentId);
        if (csClaimTypes == null || csClaimTypes.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(csClaimTypes);
        }
    }


}
